package web.service.impls;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import map.beans.WmsServerBean;
import web.dao.interfaces.WmsDaoInterface;
import web.service.interfaces.WmsServiceInterface;

@Repository("wmsService")
public class WmsServiceImpl implements WmsServiceInterface {	
	@Autowired
	WmsDaoInterface wmsDao;

	@Override
	public List<WmsServerBean> findAll() {
		return wmsDao.findAllWms();
	}

	@Override
	public Long save(WmsServerBean wms) {
		wms.setUrlId(null);
		return wmsDao.save(wms);
	}

	@Override
	public Long update(WmsServerBean wms) {
		return wmsDao.update(wms);
	}

	@Override
	public boolean delete(WmsServerBean wms) {
		return wmsDao.delete(wms);
	}

	@Override
	public List<WmsServerBean> reorderWmsServers(Map<Integer, Integer> wms) {
		return wmsDao.reorderWmsServers(wms);
	}

	@Override
	public String getMapServersAsJson() {
		return wmsDao.getMapServersAsJson();
	}

	@Override
	public WmsServerBean getWmsServer(Long id) {
		return wmsDao.getWmsServer(id);
	}

	@Override
	public void update(List<WmsServerBean> wmsServerUrls) {
		for (WmsServerBean wms : wmsServerUrls) {
			wmsDao.update(wms);
		}
	}


}
